home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / dev / misc / LEDA_gene.lha / LEDA-3.1c-generic / incl / LEDA / impl / avl_tree.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-05  |  1.3 KB  |  67 lines

  1. /*******************************************************************************
  2. +
  3. +  LEDA  3.1c
  4. +
  5. +
  6. +  avl_tree.h
  7. +
  8. +
  9. +  Copyright (c) 1994  by  Max-Planck-Institut fuer Informatik
  10. +  Im Stadtwald, 6600 Saarbruecken, FRG     
  11. +  All rights reserved.
  12. *******************************************************************************/
  13.  
  14.  
  15. #ifndef LEDA_AVL_TREE1_H
  16. #define LEDA_AVL_TREE1_H
  17.  
  18. //------------------------------------------------------------------------------
  19. //
  20. // avl_tree  
  21. //
  22. //           derived from "bin_tree"
  23. //
  24. // Ijon Tichy (1993)
  25. //
  26. //------------------------------------------------------------------------------
  27.  
  28.  
  29.  
  30. #include <LEDA/basic.h>
  31. #include <LEDA/impl/bin_tree.h>
  32.  
  33. typedef bin_tree_node* avl_tree_item;
  34.  
  35.  
  36. class avl_tree : public virtual bin_tree
  37.   // balance of node v with right (left) subtree R (L)
  38.   // bal(v) =  height(R) - height(L) in [-1 ... +1]
  39.   //
  40.   // all created nodes have balance 0
  41.  
  42.   int root_balance() { return 0; }
  43.   int leaf_balance() { return 0; }
  44.   int node_balance() { return 0; }
  45.  
  46.   void insert_rebal(avl_tree_item);
  47.   void del_rebal(avl_tree_item, avl_tree_item);
  48.  
  49.  
  50. public:
  51.  
  52.   avl_tree() {}
  53.  ~avl_tree() {}
  54.  
  55.   avl_tree(const avl_tree& T) : bin_tree(T) {}
  56.  
  57.   avl_tree& operator=(const avl_tree& T) 
  58.   { bin_tree::operator=(T); return *this; }
  59.  
  60. };
  61.  
  62. #endif
  63.  
  64.  
  65.